Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding weighted and unweighted polygon offsets using polygon skeletons #31

Merged
merged 12 commits into from
Jul 9, 2024

Conversation

romanarust
Copy link
Member

@romanarust romanarust requested a review from tomvanmele July 5, 2024 09:58
Copy link
Member

@tomvanmele tomvanmele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, just a few suggestions

"""
points = list(points)
if not TOL.is_allclose(normal_polygon(points, True), [0, 0, 1]):
raise ValueError("Please pass a polygon with a normal vector of [0, 0, 1].")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps something like this is more informative?

"The normal of the polygon should be [0, 0, 1]. The normal of the provided polygon is {}".format(normal_points(points))

@@ -66,3 +66,76 @@ def create_interior_straight_skeleton_with_holes(points, holes) -> PolylinesNump
hole = np.asarray(points, dtype=np.float64)
H.append(hole)
return straight_skeleton_2.create_interior_straight_skeleton_with_holes(V, H)


def create_offset_polygons_2(points, offset):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the code is CPython exclusive, so you could add type annotations...


Returns
-------
list of Polygon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list[:class:Polygon]

return [Polygon(points.tolist()) for points in offset_polygons]


def create_weighted_offset_polygons_2(points, offset, weights):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type annotations?


Returns
-------
list of Polygon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list[:class:Polygon]

"create_offset_polygons_2_inner",
&pmp_create_offset_polygons_2_inner,
pybind11::arg("V").noconvert(),
pybind11::arg("offset").noconvert());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think noconvert is needed on basic types, but i am not sure...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i left that one as is

@romanarust
Copy link
Member Author

Thank you! I've implemented the suggestions

@romanarust romanarust merged commit bbc802c into main Jul 9, 2024
10 checks passed
@romanarust romanarust deleted the feature/straight_skeleton_2_offsert branch July 9, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants